--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit 820f3455a1fb4bd90c75fde4a08d85d41e7a80ac
Parents : d661ba0
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Date : 2026-05-22T13:43:10+02:00
Fixed expired message cleaning sometimes targeting invalid indices
Changes
Diff
diff --git a/nomadnet/ui/textui/Channels.py b/nomadnet/ui/textui/Channels.py
index 2bdb882..ae4f19c 100644
--- a/nomadnet/ui/textui/Channels.py
+++ b/nomadnet/ui/textui/Channels.py
@@ -785,9 +785,12 @@ class RoomWidget(urwid.WidgetWrap):
else: o = None
if hasattr(o, "msg"): msg = o.msg
elif hasattr(w, "msg"): msg = w.msg
- if msg and not msg in hub_msgs: old.add(i)
+ if msg and not msg in hub_msgs: old.add(w)
- for i in reversed(list(old)): self.messagelist.delete_position(i)
+ list_body = self.messagelist.get_body()
+ for w in list(old):
+ try: list_body.remove(w)
+ except: RNS.log(f"Could not remove expired message widget {w}: {e}", RNS.LOG_DEBUG)
except Exception as e:
RNS.log("Error while cleaning room history", RNS.LOG_ERROR)
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────